import beans.Student;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;

import javax.xml.bind.annotation.XmlAccessorOrder;

/**
 * 启动类 通过BeanFactory来获取bean
 */
public class App2 {
    public static void main(String[] args) {
        //1.获取spring的上下文对象
        BeanFactory beanFactory = new XmlBeanFactory(new ClassPathResource("spring-config.xml"));
        //2.获取某个bean对象
//        Student student = beanFactory.getBean(Student.class);
        Student student=beanFactory.getBean("student",Student.class);

        //3.使用bean对象
        student.sayHello();

    }
}
